/*
 * Alloy Analyzer
 * Copyright (c) 2002 Massachusetts Institute of Technology
 *
 * The Alloy Analyzer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The Alloy Analyzer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Alloy Analyzer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package alloy.ast;

import java.util.Collections;
import java.util.Iterator;

/** 
 * Implementation support for type safe enums.
 */
public abstract class Op /*extends AbstractLeaf*/ extends VacuousLeafImpl {

	private final LeafId _leafId = new LeafId();
	
    private final String _opString;

    private final boolean _commutative;

    protected Op(String opString_, boolean commutative_) {
        super();
        _opString = opString_;
        _commutative = commutative_;
    }

    public LeafId getLeafId() {return _leafId;}

    public void setLeafId(LeafId id_) { return; }
    
    public boolean isCommutative() {
        return _commutative;
    }

    public String nodeString() {
        return _opString;
    }

    public String toString() {
        return _opString;
    }

    public Object clone() {
        return this;
    }

    public Object copy() {
        return this;
    }

    public int numChildren () { return 0; }
    
	public void addInvocationLocation(Location invocationLocation_) {return;}

	public Iterator getChildren() {
		return Collections.EMPTY_SET.iterator();
	}

	public Location getLocation() {
		return Location.UNKNOWN;
	}

	public void setParent(Node parent_) { return; }

	public String fullString() {
		return toString();
	}

   public boolean isSameAs(final Node node_) {
	   return equals(node_);
   }

   public boolean equals(final Object obj) {
	   return this==obj;
   }

   public int hashCode() {
	   return System.identityHashCode(this);
   }
}
